package com.ktjy;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ktjy.mapper.SysUserMapper;
import com.ktjy.pojo.SysUser;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test1 {

    @Test
    public void testIPage(){
        ApplicationContext ctx =new ClassPathXmlApplicationContext("spring-dao.xml");
        SysUserMapper sysUserMapper= (SysUserMapper) ctx.getBean("sysUserMapper");
        Page<SysUser> page = new Page<>(1,5);//第一页，每页只要5个
        sysUserMapper.selectPage(page,null);
        page.getRecords().forEach(System.out::println);
        System.out.println(page.getTotal());
        System.out.println("共"+ page.getPages() + "页");
        System.out.println("共"+ page.getTotal() + "条");
        System.out.println("当前第"+ page.getCurrent()+ "页");
        System.out.println("每页"+page.getSize()+"条");

    }
}
